package com.zju.DoctorGo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zju.DoctorGo.dto.NoticeFilterDTO;
import com.zju.DoctorGo.entity.Notice;
import com.zju.DoctorGo.mapper.NoticeMapper;
import com.zju.DoctorGo.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {

    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public List<Notice> getNotices(NoticeFilterDTO filter) {
        return noticeMapper.selectByFilter(filter);
    }

    @Override
    public void addNotice(Notice notice) {
        noticeMapper.insert(notice);
    }

    @Override
    public void deleteNotices(List<Long> noticeIds) {
        System.out.println(noticeIds);
        noticeMapper.deleteBatchIds(noticeIds);
    }

    @Override
    public List<Notice> checkByPatient(Long patientId) {
        return noticeMapper.selectByPatient(patientId);
    }

    @Override
    public List<Notice> checkByDoctor(Long doctorId) {
        return noticeMapper.selectByDoctor(doctorId);
    }
}
